package com.ebo.synframework.nettybase.dispatcher;

import com.ebo.synframework.nettybase.protoPool.ReusedProtoBuilder;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.GeneratedMessageV3;

public class ReqCmd {
	
	private long roleId;
	
	private int cmdIndex;
	
	private GeneratedMessageV3 message;
	
	private String serviceAndMethodStr;
	
	private int length;
	
	private String sessionKeyStr;
	
	private ReusedProtoBuilder reusedMessage;
	
	public ReqCmd(int cmdIndex, String serviceAndMethodStr, GeneratedMessageV3 message, String userIdAndsessionKeyStr, int length) {
		this.cmdIndex = cmdIndex;
		this.message = message;
		this.serviceAndMethodStr = serviceAndMethodStr;
		this.length = length;
		if(userIdAndsessionKeyStr != null && !"".equals(userIdAndsessionKeyStr)) {
			String[] temp = userIdAndsessionKeyStr.split(";");
			this.roleId = Long.parseLong(temp[0]);
			this.sessionKeyStr = userIdAndsessionKeyStr;
		}
	}
	
	public ReqCmd(int cmdIndex, String serviceAndMethodStr, ReusedProtoBuilder message, String userIdAndsessionKeyStr, int length) {
		this.cmdIndex = cmdIndex;
		this.reusedMessage = message;
		this.serviceAndMethodStr = serviceAndMethodStr;
		this.length = length;
		if(userIdAndsessionKeyStr != null && !"".equals(userIdAndsessionKeyStr)) {
			String[] temp = userIdAndsessionKeyStr.split(";");
			this.roleId = Long.parseLong(temp[0]);
			this.sessionKeyStr = userIdAndsessionKeyStr;
		}
	}

	public int getCmdIndex() {
		return cmdIndex;
	}

	public void setCmdIndex(int cmdIndex) {
		this.cmdIndex = cmdIndex;
	}
	
	public String getServiceAndMethodStr() {
		return serviceAndMethodStr;
	}

	public void setServiceAndMethodStr(String serviceAndMethodStr) {
		this.serviceAndMethodStr = serviceAndMethodStr;
	}

	public GeneratedMessageV3 getMessage() {
		return message;
	}

	public void setMessage(GeneratedMessageV3 message) {
		this.message = message;
	}

	public long getRoleId() {
		return roleId;
	}

	public void setRoleId(long roleId) {
		this.roleId = roleId;
	}

	public int getLength() {
		return length;
	}

	public String getSessionKeyStr() {
		return sessionKeyStr;
	}
	
	public ReusedProtoBuilder getReusedMessage(){
		return reusedMessage;
	}
}
